package top.riske.animalhazardassessment.common.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import top.riske.animalhazardassessment.common.http.exception.BusinessException;

/**
 * 业务异常处理，包装为响应体
 */
@Slf4j
@RestControllerAdvice
public class BusinessExceptionHandler {

    @ExceptionHandler(BusinessException.class)
    public BusinessException businessExceptionHandler(BusinessException ex) {
        log.error(ex.getMessage(), ex);

        return ex;

    }

}
